﻿@using Apps.Models.Sys;
@using Apps.Common;
@using Apps.Web.Core;

@model Apps.Models.Sys.SysModuleModel

@{
    ViewBag.Title = "Edit";
    Layout = "~/Views/Shared/_Index_LayoutEdit.cshtml";
    List<PermModel> perm = ViewBag.perm;
    if (perm == null)
    {
        perm = new List<PermModel>();
    }
}

<script type="text/javascript">
    $(function () {
        $("#btnSave").click(function () {
            $.ajax({
                url: '@Url.Action("Edit")',
                type: 'post',
                data: $("#EditForm").serialize(),
                dataType: 'json',
                success: function (data) {
                    if (data.tag == 1) {
                        window.parent.frameReturnByMes(data.message);
                        window.parent.frameReturnByReload(true);
                        window.parent.frameReturnByClose()
                    } else {
                        window.parent.frameReturnByMes(data.message);
                    }
                }
            });
        });

        $("#btnReturn").click(function () {
            window.parent.frameReturnByClose()
        });

    })
</script>

<div class="mvctool bgb">
    @Html.ToolButton("btnSave", "icon-save", "保存", true, perm, "Save")
    @Html.ToolButton("btnReturn", "icon-return", "返回", false)
</div>
@using (Html.BeginForm("Edit", "SysModule", null, FormMethod.Post, new { Id = "EditForm" }))
{
    @Html.HiddenFor(model => model.ParentId)
    <table class="fromEditTable setTextWidth300">
        <tbody>
            <tr>
                <td style="width:100px; text-align : right;">
                    @Html.LabelFor(model => model.Name):
                </td>
                <td style="width:310px;">
                    @Html.TextBoxFor(model => model.Name)
                </td>
            </tr>
            <tr>
                <td style="width:100px; text-align : right;">
                    @Html.LabelFor(model => model.Id):
                </td>
                <td style="width:310px;">
                    @Html.TextBoxFor(model => model.Id)
                </td>
            </tr>
            <tr>
                <td style="width:100px; text-align : right;">
                    @Html.LabelFor(model => model.Url):
                </td>
                <td style="width:310px;">
                    @Html.EditorFor(model => model.Url)
                </td>
            </tr>
            <tr>
                <td style="width:100px; text-align : right;">
                    @Html.LabelFor(model => model.Iconic):
                </td>
                <td style="width:310px;">
                    @Html.EditorFor(model => model.Iconic)
                </td>
            </tr>
            <tr>
                <td style="width:100px; text-align : right;">
                    @Html.LabelFor(model => model.Sort):
                </td>
                <td style="width:310px;">
                    @Html.EditorFor(model => model.Sort)
                </td>
            </tr>
            <tr>
                <td style="width:100px; text-align : right;">
                    @Html.LabelFor(model => model.Remark):
                </td>
                <td style="width:310px;">
                    @Html.EditorFor(model => model.Remark)
                </td>
            </tr>
            <tr>
                <td style="width:100px; text-align : right;">
                    @Html.LabelFor(model => model.Enable):
                </td>
                <td style="width:310px;">
                    @Html.CheckBoxFor(model => model.Enable)
                </td>
            </tr>
            <tr>
                <td style="width:100px; text-align : right;">
                    @Html.LabelFor(model => model.IsLast):
                </td>
                <td style="width:310px;">
                    @Html.CheckBoxFor(model => model.IsLast)
                </td>
            </tr>
        </tbody>
    </table>
}


